home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 May
/
EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso
/
earcd
/
gfx
/
fract
/
lfracs.lha
/
LFracs-Source.lha
/
LFracs-Source
/
StdFuncs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-01-08
|
3KB
|
80 lines
/* StdFuncs.c */
#include "StdInc.h"
#include "StdFuncs.h"
struct Library *open_library(char *name)
{
struct Library *lib_ptr;
lib_ptr = (struct Library *) OpenLibrary((UBYTE *) name,0L);
if (!lib_ptr) {
printf("no %s\n",name);
close_libs();
exit(FALSE);
}
return lib_ptr;
}
void open_libs(short flags)
{
GfxBase=NULL; IntuitionBase=NULL; DosLibrary=NULL; GadToolsBase=NULL;
MathBase=NULL; MathTransBase=NULL; AslBase=NULL; UtilityBase=NULL;
if (flags & GRAPHICS_LIB)
GfxBase = (struct GfxBase *) open_library("graphics.library");
if (flags & INTUITION_LIB)
IntuitionBase = (struct IntuitionBase *) open_library("intuition.library");
if (flags & DOS_LIB)
DosLibrary = (struct DosLibrary *) open_library("dos.library");
if (flags & MATHFFP_LIB)
MathBase = open_library("mathffp.library");
if (flags & MATHTRANS_LIB)
MathTransBase = open_library("mathtrans.library");
if (flags & GADTOOLS_LIB)
GadToolsBase = open_library("gadtools.library");
if (flags & ASL_LIB)
AslBase = open_library("asl.library");
if (flags & UTILITY_LIB)
UtilityBase = open_library("utility.library");
if (flags & LOCALE_LIB) /* don't exit if there's no locale.library! */
LocaleBase = (struct Library *) OpenLibrary((UBYTE *)"locale.library",0L);
}
void close_libs(void)
{
if (GfxBase) CloseLibrary((struct Library *) GfxBase);
if (IntuitionBase) CloseLibrary((struct Library *) IntuitionBase);
if (DosLibrary) CloseLibrary((struct Library *) DosLibrary);
if (MathBase) CloseLibrary((struct Library *) MathBase);
if (MathTransBase) CloseLibrary((struct Library *) MathTransBase);
if (GadToolsBase) CloseLibrary((struct Library *) GadToolsBase);
if (AslBase) CloseLibrary((struct Library *) AslBase);
if (UtilityBase) CloseLibrary((struct Library *) UtilityBase);
if (LocaleBase) CloseLibrary((struct Library *) LocaleBase);
}
struct Window *open_window (short x,short y,short w,short h,
char *name,ULONG flags,ULONG idcmp,
struct Gadget *gadget)
{
struct Screen *scr;
scr = IntuitionBase->ActiveScreen;
return (struct Window *) OpenWindowTags(NULL,
WA_Title,name,
WA_Left,x, WA_Top,y,
WA_Width,w, WA_Height,h, WA_MinWidth,180,
WA_MinHeight,scr->WBorTop+scr->Font->ta_YSize+1,
WA_Flags,flags, WA_IDCMP,idcmp,
WA_Gadgets,gadget,
TAG_DONE);
}
void cls(struct Window *win)
{
SetRast(win->RPort,0); RefreshWindowFrame(win);
}